<!--
    /**
     * @author RaoShuang
     * @emil 991207823@qq.com
     * @date 2020/11/23 21:35
     */
-->
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>v-on:按键修饰符</title>
		<script src="js/vuejs-2.5.16.js"></script>
	</head>

	<body>
		<div id="app">
            Vue:<input type="text" @keydown.enter="fun1">
		</div>
	</body>
	<script>
		//view model
        new Vue({
            el:"#app",
            methods:{
                fun1:function(){
                    var keyCode = event.keyCode;
                    if (keyCode == 13) {
                        alert("按下的是回车");
                    }
                }
            }
        });
	</script>

</html>